package com.qfjy.homework.fanbenpeng;

/**
 * @author:fanbenpeng
 * @date:2022/11/10 19:32
 */

import java.util.ArrayList;
import java.util.List;

/**
 * 过滤单身
 */
public class CriteriaSingle implements Criteria {

    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        List<Person> singlePersons = new ArrayList<Person>();
        for (Person person : persons) {
            if(person.getMaritalStatus().equalsIgnoreCase("单身")){
                singlePersons.add(person);
            }
        }
        return singlePersons;
    }
}

